var e = require;
var t = module;
var o = exports;
var n,
    i = o,
    a =
        ((n = function (e, t) {
            return (n =
                Object.setPrototypeOf ||
                ({__proto__: []} instanceof Array &&
                    function (e, t) {
                        e.__proto__ = t;
                    }) ||
                function (e, t) {
                    for (var o in t) t.hasOwnProperty(o) && (e[o] = t[o]);
                })(e, t);
        }),
        function (e, t) {
            function o() {
                this.constructor = e;
            }
            n(e, t), (e.prototype = null === t ? Object.create(t) : ((o.prototype = t.prototype), new o()));
        });
Object.defineProperty(i, "__esModule", {value: !0}), (i.BevNodePrioritySelector = void 0);
var r = e("BehaviorTree"),
    s = (function (e) {
        function t(t, o) {
            void 0 === o && (o = null);
            var n = e.call(this, t, o) || this;
            return (
                (n.mui_LastSelectIndex = r.k_BLimited_InvalidChildNodeIndex),
                (n.mui_CurrentSelectIndex = r.k_BLimited_InvalidChildNodeIndex),
                n
            );
        }
        return (
            a(t, e),
            (t.prototype._DoEvaluate = function (e) {
                this.mui_CurrentSelectIndex = r.k_BLimited_InvalidChildNodeIndex;
                for (var t = 0; t < this.mul_ChildNodeCount; ++t)
                    if (this.mao_ChildNodeList[t].Evaluate(e)) return (this.mui_CurrentSelectIndex = t), !0;
                return !1;
            }),
            (t.prototype._DoTransition = function (e) {
                this._bCheckIndex(this.mui_LastSelectIndex) &&
                    this.mao_ChildNodeList[this.mui_LastSelectIndex].Transition(e),
                    (this.mui_LastSelectIndex = r.k_BLimited_InvalidChildNodeIndex);
            }),
            (t.prototype._DoTick = function (e, t) {
                var o = r.BevRunningStatus.k_BRS_Finish;
                return (
                    this._bCheckIndex(this.mui_CurrentSelectIndex) &&
                        this.mui_LastSelectIndex != this.mui_CurrentSelectIndex &&
                        (this._bCheckIndex(this.mui_LastSelectIndex) &&
                            this.mao_ChildNodeList[this.mui_LastSelectIndex].Transition(e),
                        (this.mui_LastSelectIndex = this.mui_CurrentSelectIndex)),
                    this._bCheckIndex(this.mui_LastSelectIndex) &&
                        (o = this.mao_ChildNodeList[this.mui_LastSelectIndex].Tick(e, t)) &&
                        (this.mui_LastSelectIndex = r.k_BLimited_InvalidChildNodeIndex),
                    o
                );
            }),
            t
        );
    })(e("BevNode").BevNode);
i.BevNodePrioritySelector = s;
